/*
 * OptionElement.h
 *
 *  Created on: 2010-6-7
 *      Author: Guobc
 */

#ifndef OPTIONELEMENT_H_
#define OPTIONELEMENT_H_

#include "CommonElement.h"

namespace HA {
class OptionElement: public HA::CommonElement {
public:
	OptionElement();

	/**
	 * Get the set of names handles by this element.
	 * @return The names to be matched that create elements of this type.
	 */
	inline string* getIds() const {
		return mIds;
	}

	/**
	 * Get the set of names that cause this element to finish.
	 * @return The names of following elements that stop further parse.
	 */
	inline string* getEnds() const {
		return mEnds;
	}

	/**
	 * Allow creating an instance of this node.
	 * @return A new instance of this node.
	 */
	inline ASTNode* newInstance() const {
		return new OptionElement();
	}

	/**
	 * Set the new value of value attribute.
	 * @param value The new value of value attribute.
	 */
	inline void setOptionValue(const string& value) {
		setAttribute("VALUE", value);
	}

	/**
	 * Get the value of value attribute.
	 * @param value The value of value attribute.
	 */
	inline string getOptionValue() {
		return getAttribute("VALUE");
	}

	/**
	 * Get the text of this option.
	 * @return The textual contents of this OPTION element.
	 */
	string getOptionText();

private:
	static string mIds[];
	static string mEnds[];
};
}

#endif /* OPTIONELEMENT_H_ */
